*** RISK PERCEPTIONS AND PROTECTIVE BEHAVIORS: EVIDENCE FROM COVID-19 PANDEMIC ***

MASTER README 
January 26nd, 2023
      
The code in this replication package constructs figures and tables from “Risk Perceptions and Protective Behaviors: Evidence from COVID-19 Pandemic” 
by Bundorf et al. (2023) in the Review of Economics and Statistics.

========================================================
= RAW DATA
========================================================

The de-identified version of the data used in this project is available in folder "replication_files/Orig_data". Note that the data was
de-identified for public access. To protect participant’s privacy, the public file does not include date/time stamps or sub-state geographic information that was used
in the analysis. Researchers can obtain these variables by contacting Tim Mulcahy at Westat: TimothyMulcahy@Westat.com.

Additional information on the raw data:

(1) WESTAT SURVEY DATA:
     * The raw data files provided in this replication package are the de-identified versions of the research files that were 
     * used for analysis. 
 
     * Westat also provides a (nicer and interactive) Public Use File version (COVID Behaviors Survey Data) of these data that includes more information about the survey design 
     * These data are available at: https://public.richdataservices.com/westat/westat_covid_2020/
     
     * Regardless of which version of the data you use, it should be cited as:		
     * Citation: Alexander, P., Bundorf, K., Brenner, K., Brown, N., Bruce, C., Chiapparoli, N, DeMatteis, J., Evens, S., Gearing, M., Hunter, B., Jodts, E.,
      Kudupudi, R., Levin, K., Menis, A., Lyons, J., Miller, J., Newsome, J., O’Reagan, K., Pacious, M., Polyakova, Resnik, P., M., Robbins, K., Shepherd, J.,
      Streeter, J., Wernimont, J., Wivagg, J, 2020. Westat Coronavirus Attitudes and Behaviors Survey 2020 [Data]. Westat, publisher.
      
     * License/Copyright: Selected variables are available to all interested users without the need to apply for a license 
     (Creative Commons CC0 Public Domain). To the extent possible under law, Westat Inc. and Stanford University have waived all copyright and 
     related or neighboring rights to Westat/Stanford Coronavirus Attitudes and Behaviors Survey 2020 (Public Use File). 
     This work is published from: United States.

(2) OTHER SUPPORTING DATA:

The supporting_data subfolder contains additional datasets that were used in the analysis.

 - (2.1) “zipcty” folder:
      * Description: County cross reference file (FIPS/ZIP4)
      * Available at: https://wonder.cdc.gov/wonder/sci_data/codes/fips/type_txt/cntyxref.asp

 - (2.2) county_zip_augment.dta
      * Description: Since the CDC data was missing some zip codes they were manually supplemented with information from the countyfips-zip mapping online 
      * Available at: https://www.zip-codes.com/zip-code/

 - (2.3) covid_confirmed_usafacts.csv
      * Description: Covid19 cases by county and state
      * Available at: https://usafacts.org/visualizations/coronavirus-covid-19-spread-map/

 - (2.4) state_fips.dta
      * Description: State FIPS code
      * Available at: https://www.nrcs.usda.gov/wps/portal/nrcs/detail/?cid=nrcs143_013696

 - (2.5) covid_county_population_usafacts.csv 
      * Description: County population data
      * Available at: https://usafacts.org/visualizations/coronavirus-covid-19-spread-map/

 - (2.6) Counties_SIP_Order.xlsx
      * Source for county-level official SIP orders:
      (i) “6 Bay Area Counties Extend Stay-at-Home Orders through May.” Los Angeles Times, Los Angeles Times, 27 Apr. 2020, www.latimes.com/california/story            /2020-04-27/6-bay-area-counties-extend-stay-at-home-orders-through-may.
      
      (ii) “Extensive Texas Shelter-in-Place and Stay at Home Orders by County: Insight: Baker (iii) McKenzie.” Insight | 
      -Baker McKenzie, www.bakermckenzie.com/en/insight/publications/2020/03/extensive-texas-shelter-in-place-covid19.
      
      (iv) Mervosh, Sarah, et al. “See Which States and Cities Have Told Residents to Stay at Home.” The New York Times, The New York Times, 24 Mar. 2020,
      www.nytimes.com/interactive/2020/us/coronavirus-stay-at-home-order.html.
      
      (v) Tony Semerad. “How Utah's Coronavirus Restrictions Differ by County.” The Salt Lake Tribune, 8 Apr. 2020, 
      www.sltrib.com/news/2020/04/08/utahs-six-stay-at-home/.
      
      (vi) Sylte, Author: Allison. “Several Counties Rescind Stay-at-Home Orders, Adopt State Orders; Here Are Counties with Their Own Order.” 
      KUSA.com, 24 Mar. 2020, www.9news.com/article/news/health/coronavirus/colorado-cities-counties-shelter-in-place-orders/73-755635a8-4e68-49dc-8beb-60fac9325726
      
      (vii) Gross, Samantha J. “Florida Partisan Divide on Coronavirus over Shelter-in-Place.” Tampa Bay Times, Tampa Bay Times, 23 Mar. 2020, 
      www.tampabay.com/news/health/2020/03/23/florida-partisan-divide-on-coronavirus-over-shelter-in-place/

- (2.7) acs_2018_tract_data.csv and acs_2018_tract_owner_renter_housing.csv
      * Description: Census tract socio-demographic and house ownership data 
      * Available at: https://data2.nhgis.org/main

=======================================================================
= ANALYSIS 
=======================================================================
The analysis used STATA version 17. 

(1) LIST OF ALL .do FILES

* (1) (master) cba_000_replication.do - Defines paths, global macros and executes do-files. 
* (2) cba_a01_zip_county_crosswalk.do - Crosswalk zip codes to counties.
* (3) cba_a02_infection_by_county.do - Load (county-level) infection data and merge with zip codes. 
* (4) cba_a03_SIP_date_by_county.do - Calcultate the date shelter-in-place (SIP) order was enacted by county. 
* (5) (main analysis) cba_b01_clean_data.do - Load and clean raw survey data. Merge zip-county crosswalk, infection data and SIP dates.        
* (6) (main analysis) cba_b02_all_tables_figures.do - Produce all figures and tables for main analysis and appendix. 
* (7) (Appendix Table A.5) cba_b03_census_tract_acs2018.do - Merge survey data with census tract socio-demographic data to produce Appendix Table A.5. 
* (8) (revision) cba_b04_additional_analyses_revision.do 
* (9) ado/estab_config.ado
* (10) (INTERNAL ONLY) cba_c01_anonymize.do - De-identifies the data by removing sub-state geography and time stamps.
      To obtain access to time-stamps and geographical variables, researchers can contact Tim Mulcahy at TimothyMulcahy@Westat.com.

(2) HOW TO EXECUTE DO-FILES 

* (1) Download the replication_files folder 
* (2) Make sure your current working directory is the replication_files folder and the data is located in the folders as detailed above (see section RAW DATA). 
* (3) Go to the Do_files folder
* (4) Run cba_000_replication.do

=======================================================================
= OUTPUT 
=======================================================================
Figures and tables are produced in "cba_b02_all_tables_figures.do" with the exception of Table A.5, which is generated in "cba_b03_census_tract_acs2018.do"
The exhibits can be found in the folder "exhibits". Below we crosswalk output files to exhibits in the paper. 

(1) LIST OF FIGURES

* MAIN:
      - Figure 1:
                "fig_belief_risk_weighted_risk_movie.pdf", "fig_belief_risk_weighted_risk_restaurant.pdf", "fig_belief_risk_weighted_risk_transport.pdf",
                "fig_belief_risk_weighted_risk_service.pdf", "fig_belief_risk_weighted_risk_grocery.pdf" "fig_belief_risk_weighted_outcome_avg.pdf"
      - Figure 2: 
                "fig_reg_beliefs_demogeo1.pdf", "fig_reg_beliefs_demogeo2.pdf" 
      - Figure 3:
                "fig_distr_activity_weighted_movie.pdf", "fig_distr_activity_weighted_restaurant.pdf", "fig_distr_activity_weighted_transport.pdf",
                "fig_distr_activity_weighted_service.pdf", "fig_distr_activity_weighted_grocery.pdf" 
      - Figure 4:
                "ranks_overlayedbars.pdf" 

* APPENDIX:
      - Figure A.1:
		"fig_belief_risk_weighted_outcome_die.pdf", "fig_belief_risk_weighted_outcome_care.pdf", "fig_belief_risk_outcome_hospital.pdf",
                "fig_belief_risk_weighted_outcome_nottreated.pdf", "fig_belief_risk_weighted_outcome_symp.pdf"
      - Figure A.2:
                "fig_belief_risk_weighted_home.pdf", "fig_belief_risk_weighted_risk_movie_minhome.pdf", "fig_belief_risk_weighted_risk_restaurant_minhome.pdf",  
                 "fig_belief_risk_weighted_risk_transport_minhome.pdf", "fig_belief_risk_weighted_risk_service_minhome.pdf",
                 "fig_belief_risk_weighted_risk_grocery_minhome.pdf"

(2) LIST OF TABLES

* MAIN:
      - Table 1:
                "TableSummaryStatistics.tex"      
      - Table 2: 
                "TableRegBehavior.tex"     

* APPENDIX:
      - Table A.1: 
                "tab_reg_ologit.tex"            
      - Table A.2:
                "TableRegBehaviorNoNA.tex"         
      - Table A.3:
                "TableRegBehaviorMinHome.tex"            
      - Table A.4:
                "TableRegBehaviorDie.tex"            
      - Table A.5:
                TableBalanceNonResponse.tex
      - Table A.6:
                "TableRegBeliefsDemogeo.tex"
      - Table A.7:
                "TableRegPrevalenceElasticity.tex"      
                